<link rel="stylesheet" href="../core/resource/weui/weui.css">
<div class="order-list-page" ng-if="pagedata.op == 'list'">
    <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">我的次卡</div>
		<div class="fui-header-right"></div>
	</div>
	<div style="margin-top:58px"></div>
	<div id="tab" class="fui-tab fui-tab-danger">
        <a ng-class="{'external active':pagedata.status == 100}" href="javascript:" ng-click="pagedata.status =100;tool.get_list('jy_meye/timeserve_order/list/status=100',true)">全部</a>
        <a ng-class="{'external active':pagedata.status == 0}" href="javascript:" ng-click="pagedata.status =0;tool.get_list('jy_meye/timeserve_order/list/status=0',true)">待付款</a>
        <a ng-class="{'external active':pagedata.status == 1}" href="javascript:" ng-click="pagedata.status =1;tool.get_list('jy_meye/timeserve_order/list/status=1',true)">待消费</a>
        <a ng-class="{'external active':pagedata.status == 2}" href="javascript:" ng-click="pagedata.status =2;tool.get_list('jy_meye/timeserve_order/list/status=2',true)">已完成</a>
        <a ng-class="{'external active':pagedata.status == 4}" href="javascript:" ng-click="pagedata.status =4;tool.get_list('jy_meye/timeserve_order/list/status=4',true)">已取消</a>
    </div>
	<div class='fui-content order-list' style="margin-top:4.2rem">
		<div class="fui-list-group order-item" ng-repeat="item in pagedata.list">
                <a class="fui-list external" style="padding: 0.42rem 0.5rem" >
                    <div class="fui-list-inner">
                        <div class="subtitle"> 订单号: {{item.ordersn}}</div>
                    </div>
                    <div ng-show="item.status==0" class="row-remark text-cancel" style="width: 4rem; font-size: 0.65rem;text-align: right;">待付款</div>
                    <div ng-show="item.status==1" class="row-remark text-cancel" style="width: 4rem; font-size: 0.65rem;text-align: right;">待消费</div>
                    <div ng-show="item.status==2" class="row-remark text-cancel" style="width: 4rem; font-size: 0.65rem;text-align: right;">已完成</div>
                    <div ng-show="item.status==4" class="row-remark text-cancel" style="width: 4rem; font-size: 0.65rem;text-align: right;">已取消</div>
                    <div class="angle"></div>
                </a> 
                    <a href="" data-nocache="true">
                        <div class="fui-list-group-title lineblock">
                            <i class="icon jinyunicon icon-dianpu"></i> {{item.store.title || '全店可用'}}
                            <span class="status noremark" style="font-size:0.50rem">项目：<span style="color:#f60;">{{item.serve.servetitle || '默认项目'}}</span></span>
                        </div>
                    </a>
                    <a href="" class="external" data-nocache="true">
                        <div class="fui-list goods-list">
                            <div class="fui-list-media" style="">
                                <img class="" ng-src="{{tomedia(item.serve.image) || '../core/resource/images/nopic.jpg'}}">
                            </div>
                            <div class="fui-list-inner">
                                <div class="text goodstitle towline">{{item.serve.title || '服务名称'}}</div>
								<div class="text" style="color:#f60;font-size:0.50rem">[{{item.serve.servetitle}}]*{{item.serve.times}}次</div>
                            </div>
                            <div class="fui-list-angle" style="width:4rem">
                                ￥<span class="marketprice">{{item.price}}</span></div>
                        </div>
                    </a>
                <div class="fui-list-group-title lineblock">
					<span style="color:#999;font-size:0.55rem"><i class="icon jinyunicon icon-shijian" style="color:#f60;font-size:0.50rem"></i> {{item.createtime}}</span>
                    <span class="status noremark">共 <span>1</span> 个次卡 实付: <span class="text-danger">￥{{item.price}}</span></span>
                </div>
            <div class="fui-list-group-title lineblock opblock">
				<span class="status noremark">
					<div ng-show="item.status == 0" class="btn btn-sm btn-default-o order-delete" href="javascript:" ng-click="post({},'jy_meye/timeserve_order/del/','id='+item.id)">删除订单</div>
					<div ng-show="item.status == 0" class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="pagedata.pay(item.id)">立即支付</div>
					<div ng-show="item.status == 1" class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="access_json('jy_meye/server/sever_detail/id='+item.serve.serveitemid)">立即使用</div>
				</span>
            </div>
        </div>
	</div>
	<div class="content-empty" ng-show="pagedata.order_list.length == 0 ">
		  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">您暂时没有预约！</p>
	</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
scope.tool.get_list('jy_meye/timeserve_order/list/',true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list('jy_meye/timeserve_order/list/status='+scope.pagedata.status);
}
</script>
<script type="text/javascript">
scope.pagedata.pay=function(id){
	scope.post_json('/timeserve_order/pay/',{'id':id},function(pay_id){
		scope.$evalAsync();
		scope.tool.pay(pay_id,function(res){
				if(res.type=='success'){
					scope.message('支付成功！','success','jy_meye/timeserve_order/');
				}else{
					scope.message('支付失败！','success','jy_meye/timeserve_order/');
				}
		});
	});

}
</script>